home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
9536
/
9536.xpi
/
chrome
/
commentsbar_ff.jar
/
content
/
commentsbar_ff
/
bubble.js
< prev
next >
Wrap
Text File
|
2009-03-25
|
4KB
|
161 lines
var type="1";
var src;
var windframe;
var mainwindow;
var name;
var tool;
var isDragged = false;
window.onload = function () {
try{
window.sizeToContent ();
var wind = document.getElementById('bubble');
var x=toolbar_load_pref(name + "_screenx" ,"");
var y=toolbar_load_pref(name + "_screeny" ,"");
src=toolbar_load_pref(name + "_src" ,"");
var width=toolbar_load_pref(name + "_width" ,"");
var height=toolbar_load_pref(name + "_height" ,"");
type=toolbar_load_pref(name + "_type" ,"");
var scroll=toolbar_load_pref(name + "_scroll" ,"");
wind.setAttribute('screenX',x);
wind.setAttribute('screenY',y);
wind.setAttribute('width',width);
wind.setAttribute('height',height);
windframe= document.getElementById('frame');
windframe.setAttribute('type',"content-targetable");
//windframe.setAttribute('disablehistory',"true");
windframe.setAttribute('src',src);
windframe.setAttribute('height',height);
if (scroll=="0") windframe.setAttribute('style',"border: 0px solid ; margin: 0px;padding: 0px;");
if (windframe.contentWindow.DocumentComplete) windframe.contentWindow.DocumentComplete(tool);
if (windframe.contentWindow.ToolBarInit) windframe.contentWindow.ToolBarInit(tool);
windframe.addEventListener("load", loadframe, true);
}catch(e){alert(e);}
}
function startdelay ()
{
src=windframe.contentDocument.location;
if (type=="0") delay();
}
function delay ()
{
try{
var href=windframe.contentDocument.location;
var temp=''+href;
var offset=0;
offset=temp.indexOf('inbanner',0);
if (href==src || offset != -1)
{
setTimeout ('delay();', 10);
return;
}
//toolbar_pref( "newlocation", windframe.contentDocument.location );
mainwindow._content.document.location=windframe.contentDocument.location;
//alert(windframe.contentDocument.location);
window.close();
}catch(e){alert(e);}
}
function loadframe()
{
try{
if (windframe.contentWindow.DocumentComplete) windframe.contentWindow.DocumentComplete(tool);
if (windframe.contentWindow.ToolBarInit) windframe.contentWindow.ToolBarInit(tool);
setTimeout(startdelay,1000);
}catch(e){alert(e);}
}
function toolbar_getPrefBranch()
{
try {
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
return prefService.getBranch(null);
} catch(e) {alert(e);}
}
function toolbar_pref(prefName, value)
{
try {
value=escape(value);
var prefBranch = toolbar_getPrefBranch();
if (typeof(value) == "number")
prefBranch.setIntPref(prefName, value);
else if (typeof value == "string")
prefBranch.setCharPref(prefName, value);
else if (typeof value == "boolean")
prefBranch.setBoolPref(prefName, value);
} catch(e) {alert(e);}
}
function toolbar_defaultPref(prefName, value)
{
try {
value=escape(value);
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var prefBranch = prefService.getDefaultBranch(null);
if (typeof value == "string")
prefBranch.setCharPref(prefName, value);
else if (typeof value == "number")
prefBranch.setIntPref(prefName, value);
else if (typeof value == "boolean")
prefBranch.setBoolPref(prefName, value);
} catch(e) {alert(e);}
}
function toolbar_getPref(prefName)
{
try {
var prefBranch = toolbar_getPrefBranch();
switch (prefBranch.getPrefType(prefName))
{
case prefBranch.PREF_STRING:
return unescape(prefBranch.getCharPref(prefName));
case prefBranch.PREF_INT:
return prefBranch.getIntPref(prefName);
case prefBranch.PREF_BOOL:
return prefBranch.getBoolPref(prefName);
default:
return null;
}
} catch(e) {alert(e);}
return null;
}
function toolbar_clearPref(prefName)
{
try {
var prefBranch = toolbar_getPrefBranch();
toolbar_prefBranch.clearUserPref(prefName);
} catch(e) {alert(e);}
}
function toolbar_load_pref(pName, defValue)
{
try {
var val = toolbar_getPref(pName);
if( val == null )
{
val = defValue;
toolbar_defaultPref(pName, val);
}
return val;
} catch(e) {alert(e);}
}